<?php

/**
 * Created by PhpStorm.
 * User: Yieong
 * Date: 16/4/20
 * Time: 下午8:22
 */
class StepController extends AdminBaseController {

    public function index(){
        $this->setTitle('Step Report');

        $filter = new PubFilter();
        $grid   = new PubGrid();

        $jobList = array('99' => '所有') + PubDict::getDict($this->game, 'Job');

        $filter->addPlatformFilter()
            ->addServerFilter()
            ->addFilter('begin', 'input', PubFunc::t('日期'), array('value' => date('Y-m-d',strtotime('yesterday')), 'date' => 'day'))
            ->addFilter('end', 'input', PubFunc::t('至'), array('value' => date('Y-m-d',strtotime('yesterday')), 'date' => 'day'))
            ->addFilter('job', 'select', 'Job', array('options' => $jobList, 'value' => key($jobList)));

        $params = $filter->get();
        $header = StepService::indexHeader($params);
        $data   = StepService::indexData($params);

        $grid->addGrid($header, $data, array(
            'showAll' => true
        ));

        $this->out['filter'] = $filter->show();
        $this->out['grid'] = $grid->show();
    }

}